﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Presentation.Shell.Interfaces;
using Microsoft.Practices.Unity;
using Presentation.Module.Scheduling.Interfaces;
using Presentation.Module.Scheduling;
using Presentation.Module.Scheduling.Interfaces.Views;
using Presentation.Module.Scheduling.Interfaces.ViewModels;
using Presentation.Module.Scheduling.Interfaces.Services;
using Presentation.Module.Scheduling.Views;
using System.Windows;
using Application.Interfaces;

namespace Presentation.Module.Scheduling
{
    using Domain.StudyDefinition.Contracts.Repositories.Studies;

    public class ScheduleStudyModule : IPresentationModule
    {
         public IUnityContainer Container { get; private set; }

        public ScheduleStudyModule(IUnityContainer container)
        {
            // Keep an instance of the container for later use
            this.Container = container;
            
            #warning move to config file
            // register mappings from interfaces to implementations, standard Dependency Injection stuff.
            container.RegisterType<IScheduleStudyView, ScheduleStudyView>();
            container.RegisterType<IScheduleStudyViewModel, Presentation.Module.Scheduling.ViewModels.ScheduleStudyViewModel>();

            container.RegisterType<IAddScheduleStudyView, AddScheduleStudyView>();
            container.RegisterType<IAddScheduleStudyViewModel, Presentation.Module.Scheduling.ViewModels.AddScheduleStudyViewModel>();

            container.RegisterType<IScheduleStudyService, Presentation.Module.Scheduling.Services.ScheduleStudysService>();
            container.RegisterType<ISchedulingManagementService, Application.Scheduling.SchedulingManagementService>();
            container.RegisterType<Domain.Scheduling.IScheduleStudyRepository, Infrastructure.Data.Scheduling.Repositories.ScheduleStudyRepository>();

            container.RegisterType<IStudyRepository, Infrastructure.Data.StudyDefinition.Repositories.StudyRepository>();

            container.RegisterType<Application.Interfaces.IStudyDefinitionManagementService, Application.StudyDefinition.StudyDefinitionManagementService>();

        }

        public string Name
        {
            get
            {
                return "VPL Scheduler";
            }
        }

        public IModuleLandingPage LandingPage
        {
            get 
            {
                return Container.Resolve<ScheduleLandingPage>();
            }
        }
    }


    
}
